Fix Python – Writing to a new file if it doesn’t exist, and appending to a file if it does

I have a program which writes a user’s highscore to a text file. The file is named by the user when they choose a playername.
If the file with that specific username already exists, then the program should append to the file (so that you can see more than one highscore). And if a file with that username doesn’t exist (for example, if the user is ….

Fix Python – Python append() vs. + operator on lists, why do these give different results?

Why do these two operations (append() resp. +) give different results?
>>> c = [1, 2, 3]
>>> c
[1, 2, 3]
>>> c += c
>>> c
[1, 2, 3, 1, 2, 3]
>>> c = [1, 2, 3]
>>> c.append(c)
>>> c
[1, 2, 3, […]]

In the last case there’s actually an infinite recursion. c[-1] and c are the same. Why is it different with the + operation?

Fix Python – Create a Pandas Dataframe by appending one row at a time

How do I create an empty DataFrame, then add rows, one by one?
I created an empty DataFrame:
df = pd.DataFrame(columns=(‘lib’, ‘qty1’, ‘qty2′))

Then I can add a new row at the end and fill a single field with:
df = df._set_value(index=len(df), col=’qty1’, value=10.0)

It works for only one field at a time. What is a better way to add new row to d….