def function( ):
with open(“textfile”,”r”) as file:
test = file.read
s = “”
pattern = r”(?P<city>.whatever pattern etc)”
for item in re.finditer(pattern,test,re.MULTILINE):
s=s+ str(item.groupdict())
if(s=="{‘city’: ‘- -‘}")
return str("{‘city’: ‘-‘}")
else:
return (s)
function()
This is a Python related question. My returned output from a function used finditer with a...
Sample program run - Needs to be coded in python -Enter the text that you want to search for, Or DONE when finished: valiant paris The valiant Paris seeks for his love. -Enter the text that you want to search for, or DONE when finished: Romeo and Juliet Enter Romeo and Juliet aloft, at the WIndow -- Enter the text that you want to search for, DONE when finished: DONE # copy the following two lines into any # program...
Your mission in this programming assignment is to create a Python program that will take an input file, determine if the contents of the file contain email addresses and/or phone numbers, create an output file with any found email addresses and phone numbers, and then create an archive with the output file as its contents. Tasks Your program is to accomplish the following: ‐ Welcome the user to the program ‐ Prompt for and get an input filename, a .txt...
Hi, i am working with MATLAB. I have a text file from which I have to read in my data. So far i have this in my code. fid = fopen('ecgnormaloff.txt', 'r'); data = textscan(fid,'%f') According to all the websites, this should be enough to read in my points, however, I get this as my output data = 1×1 cell array {0×1 double} >> And when I try to access my data, there is nothing. I do not want to...
Hello, In Python, I am trying to create a function that will return the domain name from any inputted email address. For example, my input of john@domainname.com would return just the domainname. It needs to be done using regular expressions and the map function. I'm still stuck on trying to get the correct parameters for regular expression and also what is throwing it off. Thank you for your help! I am currently working with a list of different email addresses...
Write a program using python that reads from values from a text file and plots them using matplotlib. The input data for each graph is on three lines of the input textfile. The first line contains the x-coordiates of the points of the graph, and the second line contains the y-coordinates of the points of the graph that correspond, in the same order, to the x-coordinates on the first line. The third line in each group of three lines may...
This is my assignment prompt
This is an example of the
input and output
This is what I have so far
What is the 3rd ToDo in the main.cpp for
open the files and read the encrypted message? Does the rest of the
code look accurate?
Programming Assignment #6 Help Me Find The Secret Message Description: This assignment will require that you read in an encrypted message from a file, decode the message, and then output the message to a...
Question:
I am unable to get a output of my function on my label1 when I
click on button 1, please help?
- x Lè DRAFT P1.py - C:\Users\Darren Louw\Desktop\DRAFT P1.py (3.8.2)* File Edit Format Run Options Window Help from tkinter import* HEIGHT=300 WIDTH=400 root=Tk) lowerframe=Frame (root, bg='green', bd=10) lowerframe.place (relx=0.5, rely=0.6, relwidth=0.75, relheight=0.2, anchor='n') labell-Label (lowerframe, bg='white', font=30) labell.place (relwidth=0.25, relheight=0.8, relx=0) def countl(): countl=0 for i in range (1,1001): num= i*i if num>1000: countl=countlul print('numbers in range 1...
Part 1 Encapsulate the following Python code from Section 7.5 in a function named my_sqrt that takes a as a parameter, chooses a starting value for x, and returns an estimate of the square root of a. while True: y = (x + a/x) / 2.0 if y == x: break x = y Part 2 Write a function named test_sqrt that prints a table like the following using a while loop, where "diff" is the absolute value of the...
The payMe function Display "What's the most you are willing to pay me for my advice?" Then prompt the user with... "The more you pay, the better the answer! (minimum price: $975.46)" If the user enters a payment of less then that then return False from the function If the user enters a figure at the minimum or greater, format the number so that it displays appropriate decimals and commas (e.g. 12,456.45) and display the following... "I guess $12,456.45 seems...
in Python
Objective: Practice Displaying Output with print Function, Comments, Variable, Reading Input from the Keyboard, format output, if statement, if-else statement, loop structure. import, functions, file handling. and string methods. Lab Description: You are given a file containing protein sequences with the task of finding motifs. Motifs are certain patterns of amino acids that appear many times in protein sequences that act as indictors or markers for special regions, genes, mutations, etc. An example of what this file will...