Text13. Дан непустой текстовый файл. Удалить из него первую строку.

Решение на Python 3:

# -*- coding: utf-8 -*-
import random
import os
import sys
import codecs

file1 = "text13.txt"
temp_file = "text13_2.txt"
print("Temp file:",temp_file)
print("Write to:",temp_file)

try:
with codecs.open(file1, 'r', 'utf-8') as infile:
with codecs.open(temp_file, 'w', 'utf-8') as outfile:
first_line = infile.readline()
for line in infile:
outfile.write(line)
except IOError:
print('Open error: ',file1)

#sys.exit()

print("Rename {0} to {1}".format(temp_file,file1))
try:
os.rename(temp_file, file1)
except WindowsError:
os.remove(file1)
os.rename(temp_file, file1)
except OSError as e:
print("Error:", e)