예제 #1
0
import csv
from FormattedData import FormatData

NewData = [
    FormatData("George", 65, True),
    FormatData("Sally", 47, False),
    FormatData("Doug", 52, True)
]

for Entry in NewData:
    print(Entry)


def SaveData(Filename="", DataList=[]):
    with open(Filename, "w") as csvfile:
        DataWriter = csv.writer(csvfile,
                                delimiter='\n',
                                quotechar=" ",
                                quoting=csv.QUOTE_NONNUMERIC)
        DataWriter.writerow(DataList)
        csvfile.close()
        print("Data saved!")


SaveData("TestFile.csv", NewData)
예제 #2
0
from FormattedData import FormatData

NewData = FormatData.ReadData("TestFile.csv")

for Entry in NewData:
   print(Entry)
예제 #3
0
from FormattedData import FormatData

NewData = [FormatData("Georges", 65, True),
           FormatData("Sophie", 47, False),
           FormatData("Pierre", 52, True)]

for Entry in NewData:
   print(Entry)
예제 #4
0
from FormattedData import FormatData

NewData = [
    FormatData("George", 65, True),
    FormatData("Sally", 47, False),
    FormatData("Doug", 52, True)
]

FormatData.SaveData("TestFile.csv", NewData)
예제 #5
0
from FormattedData import FormatData
import os.path

if not os.path.isfile("Testfile.csv"):
    print("Please run the CreateFile.py example!")
    quit()

NewData = FormatData.ReadData("TestFile.csv")
for Entry in NewData:
    print(Entry)

print("\r\nAdding a record for Harry.")
NewRecord = "'Harry', 23, False"
NewData.append(NewRecord)
for Entry in NewData:
    print(Entry)

print("\r\nRemoving Doug's record.")
Location = NewData.index("'Doug', 52, True")
Record = NewData[Location]
NewData.remove(Record)
for Entry in NewData:
    print(Entry)

print("\r\nModifying Sally's record.")
Location = NewData.index("'Sally', 47, False")
Record = NewData[Location]
Split = Record.split(",")
NewRecord = FormatData(Split[0].replace("'", ""), int(Split[1]),
                       bool(Split[2]))
NewRecord.Married = True
예제 #6
0
from FormattedData import FormatData

NewData = [
    FormatData("Georges", 65, True),
    FormatData("Sophie", 47, False),
    FormatData("Pierre", 52, True)
]

FormatData.SaveData("TestFile.csv", NewData)
예제 #7
0
파일: CreateCSV.py 프로젝트: BFJonk/PPvD
from FormattedData import FormatData

NewData = [FormatData("Gerard", 65, True),
           FormatData("Sally", 47, False),
           FormatData("Daan", 52, True)]

FormatData.SaveData("TestFile.csv", NewData)
예제 #8
0
from FormattedData import FormatData

NewData = [
    FormatData("Gerard", 65, True),
    FormatData("Sally", 47, False),
    FormatData("Daan", 52, True)
]

for Entry in NewData:
    print(Entry)
예제 #9
0
import csv
from FormattedData import FormatData

NewData = [
    FormatData("Ashish", 65, True),
    FormatData("Sally", 47, False),
    FormatData("Doug", 52, True)
]

for Entry in NewData:
    print(Entry)


def SaveData(Filename="", DataList=[]):
    with open(Filename, "w") as csvfile:
        DataWriter = csv.writer(csvfile,
                                delimiter='\n',
                                quotechar=" ",
                                quoting=csv.QUOTE_NONNUMERIC)
        DataWriter.writerow(DataList)
        csvfile.close()
        print("Data saved!")


SaveData("TestFile.csv", NewData)