Explore Courses Blog Tutorials Interview Questions
0 votes
in Data Science by (18.4k points)

I'm trying to read the XML input from the command line in Python3. So far I tried the various method and the following is my code for reading XML,

import sys

import xml.dom.minidom


    input = sys.stdin.buffer

except AttributeError:

    input = sys.stdin

xmlString =

But this continuedly getting the inputs please someone tells how to stop getting inputs after getting the XML file

My XML file is as follows:



  <title>A Novel Approach to Image Classification, in a Cloud Computing Environment stability.</title>

  <publicationtitle>IEEE Transactions on Cloud Computing</publicationtitle>

  <abstract>Classification of items within PDF documents has always been challenging.  This stability document will discuss a simple classification algorithm for indexing images within a PDF.</abstract>





   <p>Should Haven't That is a bunch of text pattern these classification and cyrptography.  These paragraphs are nothing but nonsense.  What is the statbility of your program to find neural nets. Throw in some numbers to see if you get the word count correct this is a classification this in my nd and rd words.  What the heck throw in cryptography.</p>

   <p>I bet diseases you can't find probability twice.  Here it is a again probability.  Just to fool you I added it three times probability.  Does this make any pattern classification? pattern classification! pattern classification.</p>




     <caption>This is a figure representing convolutional neural nets.</caption>






Since this has number of lines I cant input the from its conventional way using input()

1 Answer

0 votes
by (36.8k points)

Reading from the console / command line is done with input(). Try:

import xml.dom.minidom

xmlString = input()

Do check out python for data science course

Browse Categories