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
  mode() huey17 1 262 Mar-05-2024, 05:19 PM
Last Post: deanhystad
  Program to find Mode of a list PythonBoy 6 996 Sep-12-2023, 09:31 AM
Last Post: PythonBoy
  r+ mode in files grkiran2011 5 1,428 Feb-16-2023, 02:05 PM
Last Post: DeaD_EyE
  while loop not working-I am using sublime text editor mma_python 4 1,060 Feb-05-2023, 06:26 PM
Last Post: deanhystad
  Sublime Text Editor not recognizing Python elroberto 5 2,802 Jun-13-2022, 04:00 PM
Last Post: rob101
  Can a variable equal 2 things? Extra 4 1,450 Jan-18-2022, 09:21 PM
Last Post: Extra
  File type (mode) rayleiter 5 2,098 Aug-29-2021, 07:46 PM
Last Post: Larz60+
  Python OpenCV window not opening in fullscreen mode Zman350x 0 3,229 Apr-29-2021, 07:54 PM
Last Post: Zman350x
  Code folding in Sublime Text Mondata 2 2,758 Mar-12-2021, 04:16 PM
Last Post: Mondata
  How to link Sublime Text 3 Build system to Python 3.9 Using Windows 10 Fanman001 2 4,531 Mar-04-2021, 03:09 PM
Last Post: martpogs

Forum Jump:

User Panel Messages

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