+ 18

Python Print Problem

Any ideas why I can't print more than 2 forward slashes in a string before SL seems to treat it like a path? Escaping the forward slashes doesn't fix it. print("a") # => a print("a/b") # => a/b print("a/b/c") # => a/b/c print("a/b/c/d") # => a../Playground/ print("a/b/c/d/e") # => a../Playground/ print("a/b/c\/d\/e") # => a/b/c\/d\/e Edit. It's a Code Playground issue - the code runs as expected on QPython3..Bug reported to SL. https://code.sololearn.com/cRrwlt25B4iu/?ref=app

21st Jan 2018, 2:54 PM
David Ashton
David Ashton - avatar
28 ответов
+ 7
@David, I tested "a/b/c/d/e" with other programming languages as Java, C#, C, C++, Ruby and PHP. It showed same problem and It run as expected in JavaScript.
25th Jan 2018, 12:47 AM
Ferhat Sevim
Ferhat Sevim - avatar
+ 15
Qpython Have Some Weird Problems For Example Some Modules That Are Supported As Default Module in Py3.x Aren't Supported In Qpython @David I Recommend You To Use PyDroid 3 You Will Love It It's Amazing Terminal With Android Linux Kernel and Some Debian Amd64 And armhf64 files with it Busybox Not Much Commands But Still Better Than Qpython Custom Pip Search For A Library, Click Install And It Will Download It As a Full Library In kbs but it will be built with a makefile to become with the real library size IIEC Always Reply On Google Play Reviews But Not On Via Email 😔 The Custom Pip Will Show You The Command That Is Used To Install The Library And It Will Show Shortcut Installs For NumPy, SciPy, Pandas And Cython You Explore The Python Library Just By Exploring the App Home It's Just 33MB And It's OFFLINE With The IIEC HackRun Files It Automatically Make Python Executable Files Be Setup Automatically Like Cach But Not Setup.py And It Really Makes A Powerful Actions Not Like Qpython
23rd Jan 2018, 9:12 PM
warlord
warlord - avatar
+ 14
@David Me Too But The Code-Playground Should Be Just A Visual Program Without Showing Any Of It's Code Because That Could Make A Valunabirty Point And That Is Very Very Bad To SoloLearn Especially That Those Are Windows Servers And They Are Easy To Get Penetrated By Unknown Sources So It's Better To Keep It Visual But It's Better If SoloLearn Showed Us The Bugs And UnSupported Modules :)
25th Jan 2018, 8:32 PM
warlord
warlord - avatar
+ 13
@Davide I Will Try To Find That Library For You
25th Jan 2018, 5:05 PM
warlord
warlord - avatar
+ 13
@David I Know This Looks A Very Stupid Idea But Try To Download The Sl4a Library From Github On Your Phone Then Move To Your Working Directory And Use Pydroid 3 I Hope This Helps 😊
25th Jan 2018, 5:26 PM
warlord
warlord - avatar
+ 11
@emmey actually I discovered the problem using "/".join() in this code https://code.sololearn.com/c4ive5jIY01g/?ref=app to solve this challenge https://www.sololearn.com/Discuss/1008929/?ref=app
21st Jan 2018, 11:27 PM
David Ashton
David Ashton - avatar
+ 10
Thanks @emmy I wonder if there is any other way around it.
21st Jan 2018, 7:09 PM
David Ashton
David Ashton - avatar
+ 9
Hi @jay. Since the problem only occurs in the SL Code Playground and since f-string only came in with Python 3.6 and since SL is still using Python 3.5 it may be a while before we find out. I tried using the str.format() method - see the code link in the question - and that didn't work, so I'm guessing f-string wouldn't either 🤔
24th Jan 2018, 11:51 PM
David Ashton
David Ashton - avatar
+ 8
Thanks @Vincent. It seems we get the same output with 'r'.
21st Jan 2018, 6:29 PM
David Ashton
David Ashton - avatar
+ 8
@Oma when I try it, print(r"a/b/c/d') gives the same output as print("a/b/c/d') I thought r only worked for Python 2.x
22nd Jan 2018, 4:22 PM
David Ashton
David Ashton - avatar
+ 8
Thanks @warlord! I'll check it out 🙂
23rd Jan 2018, 9:51 PM
David Ashton
David Ashton - avatar
+ 8
@warlord I tried Pydroid 3 and I love it! The only problem I've come across so far is I can't import androidhelper to embed sl4a.
25th Jan 2018, 12:27 AM
David Ashton
David Ashton - avatar
+ 8
@Ferhat nice digging! It would be interesting to see the Code Playground source code to see why this happens.
25th Jan 2018, 1:12 AM
David Ashton
David Ashton - avatar
+ 7
because its the format for a directory by default. You have to concatenate. edit: this answer is wrong in code playground.
21st Jan 2018, 3:08 PM
emmey
emmey - avatar
+ 7
how about using formatted strings have you tried it? like name = "jay" print(f"hello {name}")
24th Jan 2018, 10:09 PM
jay
+ 7
@Jan as far as I can see, just auto-complete Code prediction, auto indentation and real time code analysis
25th Jan 2018, 1:09 AM
David Ashton
David Ashton - avatar
+ 6
This just in: Thanks for reporting. We will fix the issue with one of the coming updates. Best, Armina
26th Jan 2018, 2:29 PM
David Ashton
David Ashton - avatar
+ 5
is this happening only in the playground of sololearn ?
22nd Jan 2018, 3:44 PM
jay
+ 4
please try putting an r before the opening ". This will tell python that it is a raw string. At least I think so.
21st Jan 2018, 4:47 PM
Vincent D'souza
Vincent D'souza - avatar
21st Jan 2018, 4:47 PM
Vincent D'souza
Vincent D'souza - avatar