loops

how can i loop through the coming frequency of the keyword

北战南征 提交于 2020-11-25 03:58:08
问题 ---- my text file from which i have to search for the keywords [name of the file --- test] <cat -Evt file> centos is my bro$ red hat is my course$ ubuntu is my OS$ fqdn is stupid $ $ $ $ tom outsmart jerry$ red hat is my boy$ jerry is samall ------ keyword file is [word.txt] <cat -Evt file > red hat$ we$ hello$ bye$ Compensation ----- my code while read "p"; do paste -d',' <(echo -n "$p" ) <(echo "searchall") <( grep -i "$p" test | wc -l) <(grep -i -A 1 -B 1 "$p" test ) done <word.txt ---- my

how can i loop through the coming frequency of the keyword

我怕爱的太早我们不能终老 提交于 2020-11-25 03:58:04
问题 ---- my text file from which i have to search for the keywords [name of the file --- test] <cat -Evt file> centos is my bro$ red hat is my course$ ubuntu is my OS$ fqdn is stupid $ $ $ $ tom outsmart jerry$ red hat is my boy$ jerry is samall ------ keyword file is [word.txt] <cat -Evt file > red hat$ we$ hello$ bye$ Compensation ----- my code while read "p"; do paste -d',' <(echo -n "$p" ) <(echo "searchall") <( grep -i "$p" test | wc -l) <(grep -i -A 1 -B 1 "$p" test ) done <word.txt ---- my

python how to repeat code

两盒软妹~` 提交于 2020-11-24 22:42:21
问题 I am a very beginner in python and I want to repeat this code. But I dont't really know how to do this without "goto". I tried to learn about loops for hours but still no sucess. Any ideas ? import requests addr = input() vendor = requests.get('http://api.macvendors.com/' + addr).text print(addr, vendor) 回答1: Create a function repeat and add your code in it. Then use while True for infinite call or for i in range(6) for 6 times call`: import requests def repeat(): addr = input() vendor =

Do iterators return a reference to items or the value of the items in Rust?

末鹿安然 提交于 2020-11-24 17:50:52
问题 If I have a vector: let mut v = vec![0, 1, 2, 3, 4, 5]; And I iterate through it: for &item in v.iter() {} Would &item here be a reference or a value? It seems like it would be a reference from the & part, but reading the details seem to show it's a value??? 回答1: Do iterators return a reference to items or the value of the items in Rust? There's no general answer to this question. An iterator can return either. You can find the type of the items by looking up the associated type Iterator: