Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: How to check an array exist in a file using Python
Post: RE: How to check an array exist in a file using Py...

This is all my current code : infile = "test.txt" outfile = "Result.txt" Array = ["6J", "yB", "ss", "11"] with open(infile, "r") as input_file: with open(outfile, "w") as result: output_list = [] ...
fitrisibarani Homework 17 6,523 Feb-27-2019, 06:54 AM
    Thread: How to check an array exist in a file using Python
Post: RE: How to check an array exist in a file using Py...

It returns an error with this code if Array_set & FBlist_set: print ("Found") result.write("1") else: print ("Not Found") result.write("0")The error is : Traceback (most recent call last): Va...
fitrisibarani Homework 17 6,523 Feb-27-2019, 02:31 AM
    Thread: How to check an array exist in a file using Python
Post: RE: How to check an array exist in a file using Py...

I tried this one and I got it. But I can not figure out to write the result to a file. Any idea? FBlist_set = set(FBlist) Array_set = set (Array) if Array_set & FBlist_set: print ("found") res...
fitrisibarani Homework 17 6,523 Feb-26-2019, 07:57 AM
    Thread: How to check an array exist in a file using Python
Post: RE: How to check an array exist in a file using Py...

Could you please explain it what should I change? and what should it be? THanks
fitrisibarani Homework 17 6,523 Feb-25-2019, 08:43 AM
    Thread: How to check an array exist in a file using Python
Post: RE: How to check an array exist in a file using Py...

I dont understand which part that I have to change. Could you please mark in the code?
fitrisibarani Homework 17 6,523 Feb-25-2019, 03:51 AM
    Thread: How to check an array exist in a file using Python
Post: RE: How to check an array exist in a file using Py...

I already change it to line[:4] , but the result is always 0, even one of the array exist on the output_list. My expectation is when one of my array in the output_list is exist, it should be returned ...
fitrisibarani Homework 17 6,523 Feb-25-2019, 01:53 AM
    Thread: How to check an array exist in a file using Python
Post: RE: How to check an array exist in a file using Py...

I tried this, but It give me always 0 outfile = "Result.txt" Array = ["6J", "xx", "ss", "11"] with open("test.txt", "r") as f: with open(outfile, "w") as result: output_list = [] for rec in f.re...
fitrisibarani Homework 17 6,523 Feb-22-2019, 03:21 AM
    Thread: How to check an array exist in a file using Python
Post: RE: How to check an array exist in a file using Py...

Ya. the Array is going to be the start of the line. I tried this outfile = "Result.txt" Array = ["6J", "xx", "ss", "11"] with open("test.txt", "r") as f: with open(outfile, "w") as result: outpu...
fitrisibarani Homework 17 6,523 Feb-22-2019, 02:26 AM
    Thread: How to check an array exist in a file using Python
Post: How to check an array exist in a file using Python

I have a txt file like this : A1B2C3D4.8Z I have an array data : ["A1", "xx", "ss", "11"] I am going to check each 2 characters from my txt file whether my array data exist in that file or not. I al...
fitrisibarani Homework 17 6,523 Feb-21-2019, 09:30 AM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020