How to sort an empty file?

I want to saw a file that was once empty. Now it is empty, but my idea is that over time it will grow.

How to check if a file is "pickable" because it seems like you cannot sort an empty file?

+5
source share
2 answers

Just use the try / except block.

def example():
  try:
    return pickle.loads("")
  except EOFError:
    return None

It’s easier to apologize except for permission. :)

+6
source

Brine is considered unsafe. Instead, try Cerealizer . This may accidentally solve your problem with an empty file.

0
source

All Articles