This commit is contained in:
s473579 2023-11-27 12:47:50 +01:00
parent 147ec79a59
commit 6091e5a846
3 changed files with 36 additions and 13 deletions

View File

@ -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[{
&quot;keyToString&quot;: { "keyToString": {
&quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;, "RunOnceActivity.OpenProjectViewOnStart": "true",
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;, "RunOnceActivity.ShowReadmeOnStart": "true",
&quot;WebServerToolWindowFactoryState&quot;: &quot;false&quot;, "WebServerToolWindowFactoryState": "false",
&quot;last_opened_file_path&quot;: &quot;/home/students/s473579/PycharmProjects/JezykiFormalne/Zajecie1/jezykiformalne&quot;, "last_opened_file_path": "J:/PycharmProjects/JezykiFormalne",
&quot;node.js.detected.package.eslint&quot;: &quot;true&quot;, "node.js.detected.package.eslint": "true",
&quot;node.js.detected.package.tslint&quot;: &quot;true&quot;, "node.js.detected.package.tslint": "true",
&quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;, "node.js.selected.package.eslint": "(autodetect)",
&quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;, "node.js.selected.package.tslint": "(autodetect)",
&quot;nodejs_package_manager_path&quot;: &quot;npm&quot;, "nodejs_package_manager_path": "npm",
&quot;vue.rearranger.settings.migration&quot;: &quot;true&quot; "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
View 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
View File

@ -0,0 +1,2 @@
Here comes Hamlet
Hamlet Hamlet again