tests
This commit is contained in:
parent
f92f5ef7f6
commit
307c51539c
10 changed files with 252 additions and 1 deletions
18
test/ruby/30.in
Normal file
18
test/ruby/30.in
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
def write_to_file(filename, content):
|
||||
with open(filename, 'w') as file:
|
||||
file.write(content)
|
||||
print(f"Written to {filename}")
|
||||
|
||||
def read_from_file(filename):
|
||||
try:
|
||||
with open(filename, 'r') as file:
|
||||
content = file.read()
|
||||
return content
|
||||
except FileNotFoundError:
|
||||
return "File not found"
|
||||
|
||||
write_to_file("test_output.txt", "Hello, World!\nThis is a test.\n")
|
||||
content = read_from_file("test_output.txt")
|
||||
print(f"File content:\n{content}")
|
||||
|
||||
print(read_from_file("nonexistent.txt"))
|
||||
Loading…
Add table
Add a link
Reference in a new issue