TaskD01
This commit is contained in:
parent
147ec79a59
commit
6091e5a846
@ -28,20 +28,20 @@
|
|||||||
<option name="hideEmptyMiddlePackages" value="true" />
|
<option name="hideEmptyMiddlePackages" value="true" />
|
||||||
<option name="showLibraryContents" value="true" />
|
<option name="showLibraryContents" value="true" />
|
||||||
</component>
|
</component>
|
||||||
<component name="PropertiesComponent">{
|
<component name="PropertiesComponent"><![CDATA[{
|
||||||
"keyToString": {
|
"keyToString": {
|
||||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||||
"WebServerToolWindowFactoryState": "false",
|
"WebServerToolWindowFactoryState": "false",
|
||||||
"last_opened_file_path": "/home/students/s473579/PycharmProjects/JezykiFormalne/Zajecie1/jezykiformalne",
|
"last_opened_file_path": "J:/PycharmProjects/JezykiFormalne",
|
||||||
"node.js.detected.package.eslint": "true",
|
"node.js.detected.package.eslint": "true",
|
||||||
"node.js.detected.package.tslint": "true",
|
"node.js.detected.package.tslint": "true",
|
||||||
"node.js.selected.package.eslint": "(autodetect)",
|
"node.js.selected.package.eslint": "(autodetect)",
|
||||||
"node.js.selected.package.tslint": "(autodetect)",
|
"node.js.selected.package.tslint": "(autodetect)",
|
||||||
"nodejs_package_manager_path": "npm",
|
"nodejs_package_manager_path": "npm",
|
||||||
"vue.rearranger.settings.migration": "true"
|
"vue.rearranger.settings.migration": "true"
|
||||||
}
|
}
|
||||||
}</component>
|
}]]></component>
|
||||||
<component name="RunManager" selected="Python.main">
|
<component name="RunManager" selected="Python.main">
|
||||||
<configuration name="main" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
|
<configuration name="main" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
|
||||||
<module name="jezykiformalne" />
|
<module name="jezykiformalne" />
|
||||||
|
21
TaskD01/run.py
Normal file
21
TaskD01/run.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import re
|
||||||
|
import sys
|
||||||
|
def write_answer(row, ouput_file):
|
||||||
|
with open(ouput_file, "a", encoding="utf-8") as file:
|
||||||
|
file.write(row)
|
||||||
|
|
||||||
|
|
||||||
|
def find_hamlet(pattern, input_file, output_file):
|
||||||
|
with open(output_file, "w", encoding="utf-8") as output_file1:
|
||||||
|
with open(input_file, "r", encoding="utf-8") as file:
|
||||||
|
for row in file:
|
||||||
|
help_row = row.strip()
|
||||||
|
if re.search(pattern, help_row):
|
||||||
|
write_answer(row, output_file)
|
||||||
|
|
||||||
|
pattern = re.compile(r'hamlet', re.IGNORECASE)
|
||||||
|
# output_file ='simple.out'
|
||||||
|
# input_file = 'simple.in'
|
||||||
|
input_file = sys.argv[1]
|
||||||
|
output_file = sys.argv[2]
|
||||||
|
find_hamlet(pattern, input_file, output_file)
|
2
TaskD01/simple.out
Normal file
2
TaskD01/simple.out
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
Here comes Hamlet
|
||||||
|
Hamlet Hamlet again
|
Loading…
Reference in New Issue
Block a user