473,385 Members | 1,445 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 1285
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
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
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: 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:
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.