Комментарии:
sir i think we have to write fr.close(); on the place of br.close(); because fr is handling file. please revert.
ОтветитьI’m a new student and need help to do this project:
I have a port scanner script it works properly, it works in Pycharm using python3.9.
I have to make a file and I did make call (Example.txt)
On this file, I have to do this:
3. If the Ports is open, it should create a file and add an entry for port number
4. In case of any exception for instance “host is not available”, “host name could not be resolved” or
due to any other error, you need to write that exception into the same file.
I’m not asking for you to do the project for me, I'm only asking ware I need to work or used in my script to accomplish this because it is my first time doing this and working with python too, and I have been struggling with this part one very bad. I can even send you the code, so you can look and only tell me what I’m doing bad, is not working.
Getting Null in output.
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
public class ReadDataFromTextFile {
public static void main(String[] args) throws IOException {
FileReader file=new FileReader("C:\\Users\\prakhar\\Desktop\\R.txt");
BufferedReader bf = new BufferedReader(file);
String str;
while(( str=bf.readLine())!=null);{
System.out.println(str);
}
bf.close();
}
}
Can we print notepad data to excel sheet through selenium?
ОтветитьSir, how we can count the words/character from text file ?
ОтветитьI have one question , assume the text file contains multiple paragraphs in it . I want to get only the 5 th paragraph text of that file ,not the complete text inside the file . Can u please suggest on this
ОтветитьSir . .how can we print the output on the label...or like displaying some text on GUI.
ОтветитьThere is one more approach
File file = new File(FilePath);
FileInputStream stream = new FileInputStream(file);
InputStreamReader reader = new InputStreamReader(stream);
BufferedReader br = new BufferedReader(reader);
String str;
while((str=br.readLine())!=null){
System.out.println(str);
}
br.close();