niromru

QT Файлы ---> Случайная строка из файла

Nov 20th, 2020 (edited)
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.15 KB | None | 0 0
  1. from random import randint
  2. f = open('lines.txt', 'r')
  3. for i in f:
  4.     if randint(0, 1) == 1:
  5.         print(i.strip('\n'))
  6.         break
  7. f.close()
Add Comment
Please, Sign In to add comment