473,385 Members | 1,742 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

how can I delet "None" in code output

shahram555
Expand|Select|Wrap|Line Numbers
  1. >>class class1:
  2.      name='civil'
  3.      def printname(self,name):
  4.          print self.name
  5.          print name
  6. >>you=class1()
  7. >>you.mark=100
  8. >>print you.printname('shahram'),you.mark
  9.  
  10.   civil
  11.   shahram
  12.   None 100
Aug 26 '14 #1
1 1286
dwblas
626 Expert 512MB
Expand|Select|Wrap|Line Numbers
  1. print you.printname('shahram'),you.mark
prints the return from printname which is None. Try the following code
Expand|Select|Wrap|Line Numbers
  1. class class1:
  2.      name='civil'
  3.      def printname(self,name):
  4.          print self.name
  5.          print name
  6.          print self.mark
  7.          return "returned from printname"
  8.  
  9. you=class1()
  10. you.mark=100
  11. print you.printname('shahram')
So you have to return something you want to print, or eliminate the print statement. You might want to look at this tutorial on functions which includes return statements.
Aug 26 '14 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: redhair | last post by:
In a asp.net page (.aspx) below, I'd like to know the in-line code ("<%Output()%> ) will be executed in which page process lifecycle? thanks. <Script Language="VB" Runat="Server"> Sub...
0
by: Metalzed | last post by:
Hi I have a little problem If I use the this C# code DateTime.Now.ToString() output = 2006-11-03 06:15:17 But if i use this code in MSSQL (CONVERT(VARCHAR(35), { fn NOW() })) output= Nov 3...
2
by: peridian | last post by:
I've gotten a really weird result crop up on my site, and I can't find any information on the web that it has been seen elsewhere. Given how weird this is, I guess it's probably a symptom of either...
0
by: cybertechk | last post by:
hi all, i have to send value of perl variable through javascript function from one page to another page. plz somone can help me showing simple snnipet. that how to send by javascript and how...
2
by: jeffcbr | last post by:
I am very new to programming and do not know what is wrong with this code... project due soon. need feedback asap please... #include <stdio.h> // Constant #define COST_OF_GLASS .02
7
by: amanda22 | last post by:
I know this is probably something silly, but I am missing something. I put the following into my compiler and I am not getting it. I know I need something to make this work, because everyone else...
1
by: marmar12 | last post by:
int a = 17, b; 59. 60. b = a; 61. printf ("b = %d\n", b); 62. 63. b = b + 1; 64. printf ("b = %d\n", b); 65. 66. b = a / b; 67. printf ("b = %d\n\n\n", b);
8
by: sisu | last post by:
here is the xml code <?xml-stylesheet href="example2.xsl" type="text/xsl" ?> <?xml version="1.0" ?> <persons> <person username="JS1"> <name>John</name> ...
2
by: adri00713 | last post by:
import java.util.ArrayList; import java.util.List; public class CombinationApp { private static int numbers= {1,2,3,4,5,6,7,8,9,10}; private static int sumsum= new int; ...
4
by: raitoHiong | last post by:
i want to get correct output: public class Temperature { private String myScale; //valid values are "F" or "C" private double myDegrees; double celsius; //default constructor
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.