Alex Bryan wrote:
I am having a problem with a list value that is empty. I have a list of
definitions called mainList. the 5th value in the list doesn't have
anything in it. In this case, the values are definitions; also, in this
case just the word cheese is defined. Here is my output to the console:
5. a sprawling,weedy plant having small lavender or white flowers and
round, flat, segmented fruits thought to resemble little wheels of cheese.
6.
7. an ingot or billet made into a convex, circular form by blows at the
ends.
I've made it so where the numbers, the period, and two spaces follow
that, then the definition. However, as you can see in 6, there is
nothing. Here is the code to print all this:
n=0
for x in mainList:
if mainList[n] == "":
print "Error on this definition"
else:
print str(n+1)+". "+str(mainL ist[n])
n=n+1
Now the two "" is where I need to figure out if it is empty. What is up
right now doesn't work; or at least doesn't give the desired result. So
I need to know how to write the if statement to make it work. This
should be simple, but I just don't know how to do it, never had this
problem before.
My guess is that your 'empty' value is something like ' ', which is not
equal to ''. Change str to repr and see better what item 6 is. 0 1494 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Shabam |
last post by:
A web application of mine developed using C# + MS SQL runs fine normally.
However when I stress test it with a load testing software (using about 60
simultaneous users) some instances start erroring out. I see two different
errors. One is a "Object reference not set to an instance of an object."
error, which appears to always contain the same information, and the other
is a "There is no row at position X.", where X is a number.
Is this...
|
by: Filips Benoit |
last post by:
Hi,
TBL_CONTACT_PERSON
CNTP_ID (auto)
CNTP_LAST_NAME (required = yes)
CNTP_FUNCTION (required = no)
CNTP_..... (all required = no)
FRM_CONTACT_PERSON_ADD_NEW
Property DATA ENTRY = YES
|
by: lihua |
last post by:
Hi, Group!
I got one question here:
We all know that fclose() must be called after file operations to
avoid unexpected errors.But there are really cases when you forget to
do that!Just
like what happens in memory operations, everyone knows the importance
of
freeing the allocated memory, but there do have memory leaks from time
to
|
by: Lance |
last post by:
Hi,
How do you test for an object existing in C#? C# seems to differentiate
between 'null' and non-existance. In other languages I could test as so:
if(ex.InnerException.StackTrace != null)
nvc.Add("** INNER EXCEPTION", ex.InnerException.StackTrace.ToString());
But an exception gets thrown at the if(...) statement. 'Object Reference
|
by: Brian |
last post by:
Hello all..
Am working on an Air Hockey game... have an table loaded into a
picture box. The borders of the table are slightly slanted. Am using
hit testing lines with GDI+ to manipulate the puck moving around. I
want the puck is bounce when it hits a border (specified by the
hitlines).
Retreieved some info on hit testing lines from Bob Powell's GDI+ FAQ
(very useful!) but i'm fairly new at the idea of hit testing and am
| |
by: EL OSO |
last post by:
Hi, let's suppose I have a
class A
{
int x;
...
public static bool operator == (A a1 , A a2)
{
return (a1.x==a2.x);
}
|
by: Jesper |
last post by:
Hi,
I've made a class with the following operator overloads listed below.
However, If I test a 'pointer' for an instace, I get an exception that the
object is not set to an insstance of an object.
ID id = new ID(1,2)
.....
e.g. if ( id != null ) <- this line calls the static overload, I guees,
instead of testing whether the id is set to an object or not. How do I test
|
by: tshad |
last post by:
I have a query that is returning a null and I am testing for null. The
value being sent back is a varChar(11) from Sql Server. If I do the query
from Query Analyser I get NULL returned.
But if I run the following:
************************************************************
dbReader = myDbObject.RunProcedure("GetNewHire", parameters);
if (dbReader.Read())
{
if (dbReader == null)
|
by: VK |
last post by:
In the continuation of the discussion at "Making Site Opaque -- This
Strategy Feasible?" and my comment at
http://groups.google.com/group/comp.lang.javascript/msg/b515a4408680e8e2
I have realized that despite suggestions to use DHTML-based modal
dialogs are very common? there is not a single fully functional
reliable copyright-free cross-browser alternative to say MsgBox
(VBScript) or showModalDialog (IE). This way such suggestions up to...
|
by: IanWright |
last post by:
I'm currently in the process of writing a class library, and I'm attempting to write as many unit tests as possible to ensure that I can weed out all the mistakes early on.
Part of this involves testing that various properties catch Exceptions if set to null, so I don't need to extensively check this later on in the program and slow down my heuristics.
What I'm interested in, is if anyone knows of an easy way of testing for Exceptions...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |