Удалил файлы data.txt и script.py для проверки игнорирования файла output.txt
This commit is contained in:
parent
cf8a82b369
commit
7b93f8f824
3
.gitignore
vendored
3
.gitignore
vendored
@ -1 +1,2 @@
|
|||||||
.venv/
|
.venv/
|
||||||
|
output.txt
|
6
requirements.txt
Normal file
6
requirements.txt
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
numpy==2.2.3
|
||||||
|
pandas==2.2.3
|
||||||
|
python-dateutil==2.9.0.post0
|
||||||
|
pytz==2025.1
|
||||||
|
six==1.17.0
|
||||||
|
tzdata==2025.1
|
25
script.py
25
script.py
@ -1,25 +0,0 @@
|
|||||||
def main():
|
|
||||||
choice = input(" Выберите 'u' для перевода в верхний регистр или 'l' для перевода в нижний регистр: ").strip().lower()
|
|
||||||
|
|
||||||
try:
|
|
||||||
with open('data.txt', 'r', encoding='utf-8') as infile:
|
|
||||||
data = infile.read()
|
|
||||||
except FileNotFoundError:
|
|
||||||
print("Файл data.txt не найден.")
|
|
||||||
return
|
|
||||||
|
|
||||||
if choice == 'u':
|
|
||||||
output_data = data.upper()
|
|
||||||
elif choice == 'l':
|
|
||||||
output_data = data.lower()
|
|
||||||
else:
|
|
||||||
print("Некорректный ввод. Пожалуйста, введите 'u' или 'l'.")
|
|
||||||
return
|
|
||||||
|
|
||||||
with open('output.txt', 'w', encoding='utf-8') as outfile:
|
|
||||||
outfile.write(output_data)
|
|
||||||
|
|
||||||
print("Результат записан в файл output.txt")
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
Loading…
Reference in New Issue
Block a user