Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
create objects from file
#4
Use the split method to break the lines apart: 'first,last,60,40,80'.split(',') will give you the list ['first', 'last', '60', '40', '80']. Then you can use int() to convert the last three items to integer: int('60') will give you 60.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
create objects from file - by faizahsan66 - Aug-23-2017, 06:48 AM
RE: create objects from file - by faizahsan66 - Aug-24-2017, 06:42 AM
RE: create objects from file - by ichabod801 - Aug-24-2017, 11:38 AM
RE: Newbie Question - by Larz60+ - Aug-23-2017, 08:45 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Create Choices from .ods file columns cspower 3 584 Dec-28-2023, 09:59 PM
Last Post: deanhystad
  Recommended way to read/create PDF file? Winfried 3 2,869 Nov-26-2023, 07:51 AM
Last Post: Pedroski55
  Use PM4PY and create working file thomaskissas33 0 647 Nov-14-2023, 06:53 AM
Last Post: thomaskissas33
  Create csv file with 4 columns for process mining thomaskissas33 3 745 Nov-06-2023, 09:36 PM
Last Post: deanhystad
  create exe file for linux? korenron 2 970 Mar-22-2023, 01:42 PM
Last Post: korenron
  my first file won't create itself MehHz2526 2 893 Nov-27-2022, 12:58 AM
Last Post: MehHz2526
  Create multiple/single csv file for each sql records mg24 6 1,387 Sep-29-2022, 08:06 AM
Last Post: buran
Sad pandas writer create "corrupted" file freko75 1 2,806 Jun-14-2022, 09:57 PM
Last Post: snippsat
  create new log file on logging? korenron 6 2,269 Mar-22-2022, 07:14 AM
Last Post: korenron
  Create zip file from the BLOB column in ORACLE DB nnsatpute 2 1,928 Dec-31-2021, 11:00 AM
Last Post: ibreeden

Forum Jump:

User Panel Messages

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