Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How does this code work?
#1
readfile1 = open("file.txt", "r")
f = readfile1.readlines()

newList = []

for line in f:
  newList.append(line.strip())

print(newList)
Yoriz write Apr-14-2022, 05:23 PM:
Please post all code, output and errors (In their entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Reply


Messages In This Thread
How does this code work? - by pd_minh12 - Apr-14-2022, 03:24 PM
RE: How does this code work? - by jefsummers - Apr-14-2022, 04:30 PM
RE: How does this code work? - by Axel_Erfurt - Apr-14-2022, 04:42 PM
RE: How does this code work? - by Pedroski55 - Apr-15-2022, 02:50 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Can't get graph code to work properly. KDDDC2DS 1 733 Sep-16-2024, 09:17 PM
Last Post: deanhystad
  I can't for the life of me get this basic If statement code to work CandleType1a 8 2,510 May-21-2024, 03:58 PM
Last Post: CandleType1a
  hi need help to make this code work correctly atulkul1985 5 2,078 Nov-20-2023, 04:38 PM
Last Post: deanhystad
  newbie question - can't make code work tronic72 2 1,621 Oct-22-2023, 09:08 PM
Last Post: tronic72
  Beginner: Code not work when longer list raiviscoding 2 1,818 May-19-2023, 11:19 AM
Last Post: deanhystad
  Why doesn't this code work? What is wrong with path? Melcu54 7 3,773 Jan-29-2023, 06:24 PM
Last Post: Melcu54
  Code used to work 100%, now sometimes works! muzicman0 5 2,896 Jan-13-2023, 05:09 PM
Last Post: muzicman0
  color code doesn't work harryvl 1 1,935 Dec-29-2022, 08:59 PM
Last Post: deanhystad
  Something the code dont work AlexPython 13 4,634 Oct-17-2022, 08:34 PM
Last Post: AlexPython
  cannot get code to work Led_Zeppelin 10 4,848 Jun-30-2022, 06:28 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

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