Python Forum
things that work in terminal mode but not in sublime mode
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
things that work in terminal mode but not in sublime mode
#1
I noticed, as an example in the Python Crash Course book . . . on pags 23 when usng terminal mode for the favorite_language example ( for .rstrip(), etc. ), it works flawlessly for me in terminal mode but I can't get it to work in sublime text,how come ?

Al
Reply
#2
What is/define “terminal mode” and “can’t get to work in sublime text”
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply
#3
(Aug-10-2021, 03:46 PM)alok Wrote: Python Crash Course book . . . on pags 23
So if i take a quick look at book.
>>> favorite_language = ' python '
>>> favorite_language.rstrip()
' python'
>>> favorite_language.lstrip()
'python '
>>> favorite_language.strip()
'python'
So here(in book) run code in interactive interpreters,because of >>>
For sublime there is SublimeREPL

If running the same over as script/code save as eg test_strip.py
favorite_language = ' python '
favorite_language = favorite_language.rstrip()
print(favorite_language)
Output:
python
So interactive interpreters(REPL) is for shorter code testing where you see result immediately.
Write real code there is no >>> and have use print() to show the result.
Run Python 3 on Sublime Text (Mac)
As mention before you don't have to Sublime Text even if that what author use.
Reply
#4
I do see the same results you see "snippsat". In terminal mode & Sublime text mode.
That is what I don't understand, in the terminal mode on line 3 the results show the right apostrophe moves left by one, because of .rstript() in line 2.
But in the Sublime Text mode ,after using print both apostrophes are gone in the output, because of .rstript(), in line 2.
How come in Subline text mode, the output dosen't shift by one on the rightside apstrophe to the left like in terminal mode ? Instead it gets rid of both apostrophes?

Other question, what do you recommend instead of using Sublime text?

Thanks for your help, Al
Reply
#5
print() will not show apostrophe.
So if doing this will see nothing,but it still working as left space is gone.
favorite_language = ' python '
favorite_language = favorite_language.lstrip()
print(favorite_language)
Output:
python
favorite_language = ' python '
favorite_language = favorite_language.lstrip()
print(favorite_language)
# Using repr will see all,same as see in interactive interpreter
print(repr(favorite_language))
Output:
python 'python '
alok Wrote:Other question, what do you recommend instead of using Sublime text?
I like VS Code(Free) unlike Sublime text(have to pay to get all features),have a tutorial here.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  while loop not working-I am using sublime text editor mma_python 4 151 Feb-05-2023, 06:26 PM
Last Post: deanhystad
  Sublime Text Editor not recognizing Python elroberto 5 886 Jun-13-2022, 04:00 PM
Last Post: rob101
  Can a variable equal 2 things? Extra 4 768 Jan-18-2022, 09:21 PM
Last Post: Extra
  File type (mode) rayleiter 5 1,415 Aug-29-2021, 07:46 PM
Last Post: Larz60+
  Python OpenCV window not opening in fullscreen mode Zman350x 0 2,291 Apr-29-2021, 07:54 PM
Last Post: Zman350x
  Code folding in Sublime Text Mondata 2 2,106 Mar-12-2021, 04:16 PM
Last Post: Mondata
  keyboard module doesn't work in the microsoft version terminal of python. username 1 1,970 Feb-25-2021, 05:19 PM
Last Post: Larz60+
  Sublime Text TechNitium 4 1,886 Jan-23-2021, 08:41 AM
Last Post: TechNitium
  unable to find module in su mode? korenron 2 1,285 Jan-10-2021, 07:41 PM
Last Post: Gribouillis
  sublime & intellisence luke83 0 1,157 Nov-20-2020, 08:26 PM
Last Post: luke83

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020