# Python - Scan for string

**URL:** <https://community.unix.com/t/python-scan-for-string/197561>\
**Category:** Shell Programming and Scripting\
**Created:** [May 19, 2008, 10:28am UTC](https://community.unix.com/t/python-scan-for-string/197561 "2008-05-19T10:28:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dhanamurthy](https://community.unix.com/letter_avatar/dhanamurthy/32/5_5575768a8748004e209b776fc1b2916d.png) [@dhanamurthy](https://community.unix.com/u/dhanamurthy)\
**Post date:** [May 19, 2008, 10:28am UTC](https://community.unix.com/t/python-scan-for-string/197561/1 "2008-05-19T10:28:19Z")

</div>

Hi  
i have a variable 'reform' and store the lines like

reform= {  
record  
string(8) ID;  
string(4) PRD;  
date("YYMMDD", split = "800101") DateofManufact;  
string(4) PRDC\_MODULE\_NUM;  
string(1) END\_OF\_RECORD = "\n";  
}

I need to search for the character "\n"in the above variable 'reform'.  
if "\n" is available then i need to return boolean  
i.e

return not "\n" in fields

I tried like below

fields = $reform\_out2.field\_names()  
return not "newline" in fields

It is not working, can any one throw some light into it.

Regards  
Dhana

---

<div class="post-metadata">

**Author:** ![ShawnMilo](https://community.unix.com/user_avatar/community.unix.com/shawnmilo/32/3304_2.png) [@ShawnMilo](https://community.unix.com/u/ShawnMilo)\
**Post date:** [May 19, 2008, 4:27pm UTC](https://community.unix.com/t/python-scan-for-string/197561/2 "2008-05-19T16:27:20Z")

</div>

Could you clarify it a bit? You're using curly braces, which indicate a dictionary, but you're not entering dictionary values. The code you provide doesn't execute in Python.

If you provide some working code that's giving bad results I'll try to help you fix it, but I can't do much with what you provided.

Thanks,  
Shawn
