Python Forum
Visual Studio Code does not print desired output but only prints "..."
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Visual Studio Code does not print desired output but only prints "..."
#1
Hi all,

I'm a Python rookie (doing an online Python for Beginners course via edX) and I'm struggling with the following.
When I want to execute the below-stated lines of code:

fhand = open("mbox-short.txt")
for line in fhand:
    line = line.rstrip()
    if line.startswith("From: "):
        print(line)
, it prints the following:
Vincents-MacBook-Air-4:PYTHON DATA  STRUCTURES vincentolivers$ /usr/bin/python
Python 2.7.10 (default, Aug 17 2018, 19:45:58) 
[GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.0.42)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> fhand = open("mbox-short.txt")
>>> 
>>> for line in fhand:
...     line = line.rstrip()
...     if line.startswith("From: "):
...         print(line)
... 
Any ideas on how to print my desired output instead of "...", i.e. all lines that start with "From: " in the handled text file?

Thanks in advance!!
Reply


Messages In This Thread
Visual Studio Code does not print desired output but only prints "..." - by vincentolivers - Sep-09-2019, 09:52 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  problem in output of a snippet code akbarza 2 432 Feb-28-2024, 07:15 PM
Last Post: deanhystad
  My code works on Jupyter Lab/Notebook, but NOT on Visual Code Editor jst 4 1,194 Nov-15-2023, 06:56 PM
Last Post: jst
  How to set PYTHONPATH in Visual Studio Code? aupres 5 4,658 Aug-15-2023, 03:51 PM
Last Post: snippsat
  how do I open two instances of visual studio code with the same folder? SuchUmami 3 965 Jun-26-2023, 09:40 AM
Last Post: snippsat
  Visual Studio Code NewPi 3 1,116 May-16-2023, 11:13 PM
Last Post: snippsat
  zfill prints extra et the end of a var tester_V 4 964 Mar-24-2023, 06:59 PM
Last Post: tester_V
  I cannot able to see output of this code ted 1 795 Feb-22-2023, 09:43 PM
Last Post: deanhystad
  Python VS Code: using print command twice but not getting output from terminal kdx264 4 1,176 Jan-16-2023, 07:38 PM
Last Post: Skaperen
  Json filter is not capturing desired key/element mrapple2020 1 1,198 Nov-24-2022, 09:22 AM
Last Post: ibreeden
  Visual Studio Code venv ibm_db error mesi1000 7 2,919 Nov-13-2022, 12:36 AM
Last Post: snippsat

Forum Jump:

User Panel Messages

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