Search Result

Collapse
4 results in 0.0014 seconds.
Keywords
Members
Tags
readline
  •  

  • (python) for some reason file.readline() is only reading every second line

    why is this skipping readlines in what it returns? i went through debugger and found it thinks the second line of the txt file is the first and continues to skip every second line.
    Code:
    def get_distances(filename):
        opener = open(filename)
        d = {}
        while file.readline(opener) != '':
            '''converts a file with cities and distances into a dictionary with values
            of distances from one city to
    ...
    See more | Go to post

  • Logic
    started a topic How to Read a Specific Line from A Text File?

    How to Read a Specific Line from A Text File?

    Hi, I'm writing a console program in order to make my own keyboard shortcuts.
    Code:
    ConsoleKeyInfo input;
    
    do
    {
           if (File.Exists("info.txt") == true) ; 
           else Console.WriteLine("File not found! \nPress any key to try again..."); Console.ReadKey(true);
    } while (File.Exists("info.txt") == false);
    
    StreamReader reader = new StreamReader("info.txt");
    ...
    See more | Go to post

  • elvan
    started a topic I cant use console.readline after console.read

    I cant use console.readline after console.read

    Code:
    using System;
    namespace namespace1
    {
        class class1
        {
            static void Main(String[] args)
            {
                Console.WriteLine("What is your initial?");
                int name1 = Console.Read();     
                char ch = Convert.ToChar(name1);
                Console.WriteLine("What is your name again?");
                string name2 = Console.ReadLine();
    ...
    See more | Go to post
    Last edited by tlhintoq; Feb 10 '10, 12:30 PM. Reason: [CODE] ...Your code goes between code tags [/CODE]

  • using the "readline" function to read a specific line

    i am trying to write code to assign values from a line of a text file to variables in my program. the problem is that I don't need all the values written in the text file assigned to variables. So. Basically I want to know if there is a way to use "ReadLine" to access specific lines in a text file.

    any type of help would be appreciated
    See more | Go to post
Working...