Piszę w Pythonie kod szukający pliku i podmieniający nazwę w pliku wynikowym, co robię…
- User
Piszę w Pythonie kod szukający pliku i podmieniający nazwę w pliku wynikowym, co robię źle? import re, os from pathlib import Path in_file = (Path().resolve() / "dane_wejsciowe_timestamps.txt") if not os.path.isfile(in_file): print(f"Nie znaleziono pliku: {in_file}")
out_file = in_file.replace("timestamps", "filtered" )
TypeError Traceback (most recent call last) Cell In[4], line 6 3 if not os.path.isfile(in_file): 4 print(f"Nie znaleziono pliku: {in_file}") ----> 6 out_file = in_file.replace("timestamps", "filtered" )
TypeError: Path.replace() takes 2 positional arguments but 3 were given
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.